/*
 * WaitRoomApi.cpp
 *
 */
#include <exception>
#include "WaitRoomApi.h"

WaitRoomApi::WaitRoomApi():m_buffer("/tmp/wait_room",3)
{
}

WaitRoomApi::~WaitRoomApi()
{
}

void WaitRoomApi::init()
{
	m_buffer.init();
}

void WaitRoomApi::cleanup()
{
	m_buffer.cleanup();
}

void WaitRoomApi::enterRoom(int id)
{
	if(!m_buffer.put(id))
		throw std::exception();
}

int WaitRoomApi::getPassenger()
{
	int id;
	if(!m_buffer.get(id))
		throw std::exception();

	return id;
}
